#!/usr/bin/python

import socket

sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sk.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
sk.bind(('127.0.0.1',1280))
sk.listen(10)

while True:
    ck, client = sk.accept()
    while True:
        data = ck.recv(128)
        if not data:
            ck.shutdown(socket.SHUT_RDWR)
            ck.close()
            break
        print 'data recved: [',data,']' 
        ck.send('echo:' + data)
        
